package zheezes.eisp.collect.model;

import org.apache.log4j.Logger;

import zheezes.eisp.data.dao.DataAccessor;
import zheezes.eisp.data.orm.CollectTask;
import zheezes.socket.PostOffice;
import zheezes.util.DateFormatUtil;


public abstract class CollectTaskHandler implements Runnable {
	private static Logger logger = Logger.getLogger(CollectTaskHandler.class);	
	
	protected CollectTask task;
	protected PostOffice postOffice;
	protected DataAccessor dataAccessor;
	protected boolean terminated = false;
	// protected Mailbox mailbox = new Mailbox();
	
	static {
		logger.debug("Loading");
	}
	
	public void info() {
		logger.debug(String.format("abstract collect handler, task date = %s", DateFormatUtil.getDateFmt().format(task.getDataDate())));
	}

	public void setPostOffice(PostOffice postOffice) {
		this.postOffice = postOffice;
	}

	public void setDataAccessor(DataAccessor dataAccessor) {
		this.dataAccessor = dataAccessor;
	}

	public CollectTask getTask() {
		return task;
	}

	public void setTask(CollectTask task) {
		this.task = task;
	}
	
	public void terminate() {
		terminated = true;
	}
	
	public boolean isTerminated() {
		return terminated;
	}
}
